<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta charset="UTF-8">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"  crossorigin="anonymous"></script>


   



<!--    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"-->
<!--          integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">-->
<!--    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"-->
<!--            integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd"-->
<!--            crossorigin="anonymous"></script>-->
<!--    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">-->
    <script th:src="@{/static/mysource/js/jquery-3.3.1.min.js}"></script>
<!--    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>-->
    <link rel="icon" href="../static/img/favicon1.ico" type="images/x-ico"/>
    <link rel="stylesheet" th:href="@{/static/css/show.css}">

    <!--layui-->
    <link rel="stylesheet" th:href="@{/static/layui/css/layui.css}">
    <!--layui-->

    <title>评委打分</title>
</head>

<body class="bj">
<a th:href="@{/logout}" class="layui-btn">退出</a>
<div style="margin-top: 7%">
    <div class="container">
        <h1 align="center" id="mid" th:text="${info.getMid()}"></h1>
        <div class="playerData">
            <div class="col-lg-5 playerdiv">
                <input type="hidden" id="jid" th:value="${session.user.getId()}">
                <div class="headImg">
                    <img th:src="@{(${info.getAPictureUrl()})}" class="ti">
                </div>
                <div class="playerId">
                    <span th:text="${info.getAName()} ">888 号</span>
                    <b id="aid"  th:text="${info.getPlayerA()}"></b> 号选手
                </div>
                <div>
                    <span th:text="${info.getASong()} ">天堂</span>
                </div>
                <form class="form-inline">
                    <div style="margin-left: 120px">
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control"  style="height: 27px" id="aScore" >
                    </div>
                    <button type="button" onclick="aScores()"  class="btn btn-default  btn-success" >打分</button>
                </form>
            </div>
            <div class="col-lg-2 pk"></div>
            <div class="col-lg-5 playerdiv">
                <div class="headImg">
                    <img th:src="@{(${info.getBPictureUrl()})}" class="ti">
                </div>
                <div class="playerId">
                    <span th:text="${info.getBName()}">888 号</span>
                    <b id="bid" th:text="${info.getPlayerB()}"></b> 号选手
                </div>
                <div>
                    <span th:text="${info.getBSong()} ">天堂</span>
                </div>
                <div class="form-inline">
                    <div style="margin-left: 120px">
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control"  style="height: 27px" id="bScore" >
                    </div>
                    <button type="button" onclick="bScores()" class="btn btn-default  btn-success" >打分</button>
                </div>


            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

    function aScores(){

        var jid = $("#jid").val();
        var mid = $("#mid").text();
        // var jid = 2;
        var playerId = $("#aid").text();
        var aScore = $("#aScore").val();

        console.log(jid)
        console.log(mid)
        console.log(playerId)
        console.log(aScore)
        $.ajax({
            url:"/score/doScore",
            dataType:"json",
            type:"post",
            data: {
                "jid":jid,"mid":mid,"playerId":playerId,"judgesScoring":aScore
            },
            success:function (data){
                if(data.user.status==1){
                    alert("已经有评委打过分了")
                    return false;
                }
                if (data.user.status==0){
                    alert("请先填写分数")
                    return false;
                }else {
                    if (data.flag){
                        alert(data.msg);
                        location.reload()
                        // location.href='/score/page'
                    }else {
                        alert(data.msg);
                        return false;
                    }
                }

            }
        })
    }
    function bScores(){
        var jid = $("#jid").val();
        var mid = $("#mid").text();
        // var jid = 2;
        var playerId = $("#bid").text();
        var bScore = $("#bScore").val();
        console.log(jid)
        console.log(mid)
        console.log(playerId)
        console.log(bScore)

        $.ajax({
            url:"/score/doScore",
            dataType:"json",
            type:"post",
            data: {
                "jid":jid,"mid":mid,"playerId":playerId,"judgesScoring":bScore
            },
            success:function (data){
                if (data.user.status==0){
                    alert("请先填写分数")
                    return false;
                }else {
                    if (data.flag){
                        alert(data.msg);
                        location.reload()
                        // location.href='/score/page'
                    }else {
                        alert(data.msg);
                        return false;
                    }
                }

            }
        })
    }
</script>
</body>

</html>